using System.Collections;
using Anvil.Core;

namespace Anvil.Core.Commands
{
	/// <summary>
	/// Run update for keys as key.
	/// </summary>
	public class BaseBatchUpdate : BaseUpdate
	{
		public override bool RequestExecute(IRequestContext context)
		{
			string key = context[Tokens.KEY] as string;
			object[] keys = context[Tokens.KEYS] as object[];
			foreach (object o in keys)
			{
				context[key] = o as string;
				Mapper.Update(QueryID, context);
			}
			IList list = new ArrayList(1);
			list.Add(keys.Length);
			context.Outcome = list;
			return CONTINUE;
		}
	}
}